 <?php
 if($dulieu){
    $idnet=$dulieu->idpb;
    $pb_value_array= unserialize($dulieu->pb_value);
 };
 ?>
 <script>
 //chon hien net content
 $('document').ready(function(){
    if($('.typenet').val()=='Content'){
        $('.headerscript').show();
    }
    $('.typenet').live('change',function(){
        var t= $(this).val();
        if(t=='Content'){
            $('.headerscript').fadeIn(800);
        }else{
            $('.headerscript').hide();
        }
    })
 }) 
 </script>
 <style>
 textarea{
    width:500px;
    height:60px;
 }
 </style>
<form class="clearfix" method="POST" action="<?php echo base_url().'admin/route/'.$this->uri->segment(3).'/'.$this->uri->segment(4);?>">
 <?php if($dulieu){echo '<input class="hide" value="'.$dulieu->id.'" name="id"/>';} ?>
                    <table class="tb_content clearfix">                       
                        <tr>
                            <td class="span200" >Title</td>
                            <td>
                                <input value="<?php if($dulieu){echo $dulieu->title;} ?>" class="span300" type="text" name="title" />
                            </td>                            
                        </tr>  
                        
                        <tr>
                            <td>Type</td>
                            <td>
                                <select class="typenet" name="type">
                                    <option <?php if($dulieu){echo $dulieu->type=='None'?' selected':'';} ?> value="None">None</option>
                                    <option <?php if($dulieu){echo $dulieu->type=='Banner'?' selected':'';} ?> value="Banner">Banner</option>
                                    <option <?php if($dulieu){echo $dulieu->type=='Content'?' selected':'';} ?> value="Content">Content</option>
                                    <option <?php if($dulieu){echo $dulieu->type=='Wall'?' selected':'';} ?> value="Wall">Wall</option>                                
                                </select>                                
                            </td>                            
                        </tr> 
                        
                        <tr>
                            <td>Rate</td>
                            <td>
                                <input value="<?php if($dulieu){echo $dulieu->rate;} ?>" class="span300" type="text" name="rate" />
                            </td>                            
                        </tr>
                        
                        <tr class="hide headerscript">
                            <td>Header Script</td>
                            <td>
                                <textarea name="header_script"><?php if($dulieu){echo $dulieu->header_script;} ?></textarea>
                            </td>                            
                        </tr>
                        
                        <tr>
                            <td>Iframe or Content</td>
                            <td>
                                <textarea name="script"><?php if($dulieu){echo $dulieu->script;} ?></textarea>
                            </td>                            
                        </tr>
                        
                        <tr>
                            <td>Subid</td>
                            <td>
                                <input value="<?php if($dulieu){echo $dulieu->subid;} ?>" class="span100" type="text" name="subid" value="0" />
                                ( *Net Banner)
                            </td>
                            
                        </tr> 
                        
                        <tr>
                            <td>Order</td>
                            <td>
                                <input value="<?php if($dulieu){echo $dulieu->order;} ?>" class="span100" type="text" name="order" value="0" />                                
                            </td>
                            
                        </tr>
                        
                        <tr>
                            <td>Show / Hide</td>
                            <td>
                                <span class="box_switch<?php if($dulieu){echo $dulieu->show==1? '':' off';} ?>">
                                    <a href="">switch off</a>
                                    <input id="off_on" type='hidden' name="show" value="1"/>
                                </span>                                
                            </td>                            
                        </tr> 
                        
                       <tr><td colspan="2" class="submit_td">Postback:</td></tr> 
                       <tr>
                            <td colspan="2" >
                            <div class="pbcolleft left"> 
                                <span class="span100_pb left">Pass:<input title="#pass" value="<?php if($dulieu){echo $dulieu->pb_pass;} ?>" style="width:119px;" type="text" name="pb_pass" /></span>
                                <span class="span100_pb left">Id_user:
                                    <input title="#1" value="<?php if($dulieu){echo $pb_value_array[1];} ?>" class="span50" type="text" name="pb_value[1]" />
                                    <span class="right">=</span>
                                    <input title="#0" value="<?php if($dulieu){echo $pb_value_array[0];} ?>" class="span50" type="text" name="pb_value[0]" />
                               </span>
                                <span class="span100_pb left">Credit:                                    
                                    <input title="#3" value="<?php if($dulieu){echo $pb_value_array[3];} ?>" class="span50" type="text" name="pb_value[3]" />
                                    <span class="right">=</span>
                                    <input title="#2" value="<?php if($dulieu){echo $pb_value_array[2];} ?>" class="span50" type="text" name="pb_value[2]" />
                                </span>
                                <span class="span100_pb left">Offer:                                    
                                    <input title="#5" value="<?php if($dulieu){echo $pb_value_array[5];} ?>" class="span50" type="text" name="pb_value[5]" />
                                    <span class="right">=</span>
                                    <input title="#4" value="<?php if($dulieu){echo $pb_value_array[4];} ?>" class="span50" type="text" name="pb_value[4]" />
                                </span>
                            </div>
                            <div class="pbcolright left">
                                <input value="<?php echo $idnet;?>" class="span300" type="hidden" name="idpb" />
                                <b>Postback:</b><br /><br />
                                <div class="link_pb hide">
                                    <span><?php echo base_url().'postback/<div class="type_net"></div>/'.$idnet;?>/</span>
                                    <span id="pass"></span>
                                    <span id="0"></span>
                                    <span id="1"></span>
                                    <span id="2"></span>
                                    <span id="3"></span>
                                    <span id="4"></span>
                                    <span id="5"></span>                                
                                </div>
                                <div id="linkpb"></div>
                            </div>
                            </td>
                                                  
                       </tr>                
                        <tr><td colspan="2" class="submit_td"><input type="submit" value="Submit" /></td></tr> 
                    </table>
                    <script type="text/javascript" src="<?php echo base_url();?>temp/admin/js/network_edit.js"></script>  
                
</form>

